﻿<UserControl 
  x:Class="iTFF.WPF.View.PreferencesView"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:l="clr-namespace:iTFF.WPF.Resources.Languages"
  xmlns:lib="clr-namespace:iTFF.WPFControlLibrary;assembly=iTFF.WPFControlLibrary">
  <StackPanel>
    <GroupBox Header="Toaster">
      <Grid Margin="4">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="40" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <CheckBox IsChecked="{Binding EnableAutoToaster}" 
                  Content="{x:Static l:Strings.PreferencesViewEnableToaster}" Margin="2" />

        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="2">
          <TextBlock Text="{x:Static l:Strings.PreferencesViewToasterShowToastFor}" VerticalAlignment="Center" />
          <TextBox Text="{Binding ShowToasterTimer}" Width="30" />
          <TextBlock Text="{x:Static l:Strings.PreferencesViewToasterSeconds}" VerticalAlignment="Center" />
        </StackPanel>

        <CheckBox Grid.Row="2" IsChecked="{Binding HideToasterOnClick}" Content="{x:Static l:Strings.PreferencesViewToasterHideOnClick}" Margin="2" />

        <CheckBox Grid.Row="3" IsChecked="{Binding ReappearToasterOnMouseOver}" Content="{x:Static l:Strings.PreferencesViewToasterReappearOnMouseOver}" Margin="2" />

        <GroupBox Grid.Row="4" Margin="2" Header="{x:Static l:Strings.PreferencesViewToasterSkin}" >
          <StackPanel Orientation="Vertical">
            <ComboBox SelectedItem="{Binding SelectedToasterSkin}" DisplayMemberPath="Name" ItemsSource="{Binding ToasterSkins}" 
                    IsSynchronizedWithCurrentItem="True" />

            <StackPanel Orientation="Horizontal" DataContext="{Binding SelectedToasterSkin}">
              <TextBlock Text="{x:Static l:Strings.PreferencesViewChooseForeground}" Margin="5" 
                         VerticalAlignment="Center" MaxWidth="150" TextWrapping="WrapWithOverflow" />
              
              <ToggleButton x:Name="colorButton" VerticalAlignment="Center">
                <Label x:Name="colorLabel" Background="{Binding ForegroundBrush}" Margin="2,2" Width="20" Height="20" />
              </ToggleButton>

              <Popup PlacementTarget="{Binding ElementName=colorButton}" Placement="Bottom" Width="450" PopupAnimation="Fade" 
                     IsOpen="{Binding ElementName=colorButton, Path=IsChecked, Mode=TwoWay}">
                <lib:ColorPicker SelectedColor="{Binding ForegroundColor, Mode=TwoWay}" Background="White" />
              </Popup>

            </StackPanel>
          </StackPanel>
        </GroupBox>

        <Button Grid.Column="2" Grid.RowSpan="2" Content="{x:Static l:Strings.PreferencesViewShowToaster}" Command="{Binding ShowToasterCommand}" Margin="4" />

        <Border Grid.Column="2" Grid.Row="2" Grid.RowSpan="3" BorderBrush="Black" BorderThickness="2" CornerRadius="3" Margin="4" VerticalAlignment="Center">
          <ContentControl Content="{Binding SelectedToasterSkinUC}" />
        </Border>

      </Grid>
    </GroupBox>

    <GroupBox Header="{x:Static l:Strings.PreferencesViewLanguages}">

      <Grid Margin="4">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="10" />
          <ColumnDefinition Width="200" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="5" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Text="{x:Static l:Strings.PreferencesViewApplicationLanguage}" Margin="0,0,20,0" TextWrapping="WrapWithOverflow" />
        <ComboBox Grid.Column="2" DisplayMemberPath="NativeName" ItemsSource="{Binding AvailableCultures}" SelectedItem="{Binding SelectedCulture}" VerticalAlignment="Center" />

        <TextBlock Grid.Row="2" Text="{x:Static l:Strings.PreferencesViewArtworkLocale}" Margin="0,0,20,0" TextWrapping="WrapWithOverflow" />
        <ComboBox Grid.Row="2" Grid.Column="2" DisplayMemberPath="DisplayName" ItemsSource="{Binding AvailableAmazonLocales}" SelectedItem="{Binding ArtworkSelectedAmazonLocale}" VerticalAlignment="Center" />
      </Grid>

    </GroupBox>

  </StackPanel>
</UserControl>
